var now = getNowFormatDateTime(); 
var username = sessionStorage.getItem("name");
var userid = sessionStorage.getItem("userId");
var shopcode=GetQueryString("shopcode");
var shopname=decodeURI(decodeURI(GetQueryString("shopname")));
var trStr ="";
var trStr1 ="";
$(document).ready(function(){
	$("#shopcode").append(shopcode);
	$("#shopname").append(shopname);
	$.ajax({
			url: '../../equipment_info/getSelectBody'
			,type:'post'
			,dataType:'json'
			,contentType: "application/json; charset=utf-8"
			,data:JSON.stringify({search1:{"shopcode":shopcode}})  
			,success: function(res){
				if(res.data.length>0){
				for (var i = 0; i < res.data.length; i++) {
						trStr += '<tr class="thin-border-bottom">'
							+'	<td><br><br>'+res.data[i].equipmentname+'</span></td>'
							+'	<td>编号：'+res.data[i].num+'<br>'
							+'	保质期：'+res.data[i].warranty+'年<br>'
							+'	是否在保：'+(res.data[i].warrantyflag==0?'是':'否')+'<br>'
							+'	购买日期：'+res.data[i].buydate+'<br>'
							+'	设备厂商：'+res.data[i].company+'<br></td>'
							+'</tr>'
					
					}
				}
				$('#data').append(trStr);
				trStr ="";
			}
	});	
	$.ajax({
			url: '../../repair_info/getSelectBody'
			,type:'post'
			,dataType:'json'
			,contentType: "application/json; charset=utf-8"
			,data:JSON.stringify({"shopcode":shopcode})  
			,success: function(res){
				console.log(res);
				var flagname ="";
				if(res.data.length>0){
					for (var i = 0; i < res.data.length; i++) {//状态 1:未接单;2:未完成;3:待确认;4:待评价;5:已完成;21:未开始;22:已开始;
						switch(res.data[i].flag){
						    case 1:
						        flagname = '未接单';
						        break;
						    case 21:
						        flagname = '未开始';
						        break;
							case 22:
						        flagname = '已开始';
						        break;
							case 3:
						        flagname = '待确认';
						        break;
							case 4:
						        flagname = '待评价';
						        break;
						    default:
						       	flagname = '已完成';
						}
						trStr1 += '<tr class="thin-border-bottom">'
							+'	<td>'+res.data[i].repairdate.substring(0,10)+'</span></td>'
							+'	<td>'+res.data[i].instruction+'</span></td>'
							+'	<td>'+flagname+'</span></td>'
							+'</tr>'
						
				    }
				}
				$('#data1').append(trStr1);
				trStr1 ="";
			}
	});	
});
